home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / lib / perl5 / AutoLoader.pm < prev    next >
Text File  |  1995-07-02  |  645b  |  26 lines

  1. package AutoLoader;
  2. use Carp;
  3.  
  4. AUTOLOAD {
  5.     my $name = "auto/$AUTOLOAD.al";
  6.     $name =~ s#::#/#g;
  7.     eval {require $name};
  8.     if ($@) {
  9.     # The load might just have failed because the filename was too
  10.     # long for some old SVR3 systems which treat long names as errors.
  11.     # If we can succesfully truncate a long name then it's worth a go.
  12.     # There is a slight risk that we could pick up the wrong file here
  13.     # but autosplit should have warned about that when splitting.
  14.     if ($name =~ s/(\w{12,})\.al$/substr($1,0,11).".al"/e){
  15.         eval {require $name};
  16.     }
  17.     if ($@){
  18.         $@ =~ s/ at .*\n//;
  19.         croak $@;
  20.     }
  21.     }
  22.     goto &$AUTOLOAD;
  23. }
  24.  
  25. 1;
  26.